package cz.artin.gemini.admin.persist.user.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
import javax.persistence.TypedQuery;

import cz.artin.gemini.shared.domain.admin.User;

public class UserDaoImpl implements UserDao {

	@PersistenceContext(type = PersistenceContextType.TRANSACTION, unitName = "main-unit")
	protected EntityManager entityManager;

	@Override
	public List<User> listUsers() {
		TypedQuery<User> query = entityManager.createQuery("FROM User u ORDER BY u.userName", User.class);
		return query.getResultList();
	}

}
